package com.niodata.dp.api.server;

import com.niodata.dp.mybatis.MyBatisConfiguration;
import com.niodata.dp.task.log.TaskLogManager;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.annotation.PropertySources;

@SuppressWarnings("deprecation")
@EnableAutoConfiguration(exclude = MongoAutoConfiguration.class)
@Configuration
@ComponentScan(basePackages = {"com.niodata.dp.*", "com.niodata.dt.*"}, excludeFilters = {
      @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = TaskLogManager.class)})
@SpringBootApplication
@Import(MyBatisConfiguration.class)
@MapperScan({"com.niodata.dp", "com.niodata.dt"})
@PropertySources(
      value = {
            @PropertySource("classpath:application.properties"),
            @PropertySource("classpath:hive.properties")
      }
)
public class ApiServer {

  public static void main(String[] args) {

    SpringApplication.run(ApiServer.class, args);
  }

}
